<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<link rel="stylesheet" type="text/css" href="../../../Themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="../../../Themes/icon.css">
		<link rel="stylesheet" type="text/css" href="../../../CSS/demo.css">
		<title></title>
	</head>

	<body style="padding: 0;">
		<form id="ff">
			<table class="displaytable" cellpadding="12" style="padding: 30px;width: 100%;">
				<tr>
					<td width="40%">租户名称</td>
					<td width="60%">
						<input type="text" style="width: 100%;" name="TENANT_NAME" id="input_TENANT_NAME" class="easyui-textbox" />
					</td>
				</tr>
				<tr>
					<td>库房名称</td>
					<td>
						<input type="text" style="width: 100%;" name="STOREHOUSE_NAME" id="input_STOREHOUSE_NAME" class="easyui-combobox" />
					</td>
				</tr>
				<tr>
					<td>库存为0不显示</td>
					<td><input class="easyui-switchbutton" checked id="input_CURR_AMOUNT"></td>
				</tr>
			</table>
			<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" style="width: 80px;margin-left:150px;" onclick="doSearch()">查询</a>
		</form>
		<script type="text/javascript" src="../../../JS/jquery.min.js"></script>
		<script type="text/javascript" src="../../../JS/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="../../../JS/common.js"></script>
		<script type="text/javascript" src="../../../JS/FrozenShareFunction/FrozenShare.js"></script>
	</body>
	<script type="text/javascript">
        var currSTATE=1;
        initSwitchButton();
		initCombobox();

		function doSearch() {
			var searchCondition = "";

			if($("#input_TENANT_NAME").textbox('getValue').trim().length != 0) {
				searchCondition = "TENANT_NAME=" + $("#input_TENANT_NAME").textbox('getValue').trim();
			}
			if($("#input_STOREHOUSE_NAME").textbox('getValue').trim().length != 0) {
				if(searchCondition == "") {
					searchCondition = "STOREHOUSE_ID=" + $("#input_STOREHOUSE_NAME").textbox('getValue').trim();
				} else {
					searchCondition += "&STOREHOUSE_ID=" + $("#input_STOREHOUSE_NAME").textbox('getValue').trim();
				}
			}
			if(searchCondition == "") {
				$.messager.alert("警告", "查询条件不能为空");
				return;
			}
			else
			{
				if(currSTATE==1)
				{
					searchCondition+="&CURR_AMOUNT=1";
				}
			}
			var parentLocation;
			parentLocation = searchParent("LeasingOperationList.html");
			parentLocation.loadDatagridData(searchCondition);
			parentLocation.dialogClose();
		}

		function initCombobox() {
			createTenantCombobox();
			createShoreHouseComboboxByID();
		}

		function initSwitchButton() {
			$('#input_CURR_AMOUNT').switchbutton({
				onText: '启用',
				offText: '不启用',
				onChange: function(checked) {
					if(checked) {
						currSTATE = 1;
					} else {
						
						currSTATE = 0;
						console.log(currSTATE);
					}
				}
			})
		}
	</script>

</html>